﻿'use strict';

$(document).ready(function () {

});

$(document).bind('contextmenu', function (e) {
	$('#mm').menu('show', {
		left: e.pageX,
		top: e.pageY
	});
	return false;
});

Alright.start({
    canvas: 'game-screen',
    width:  800,
    height: 600,
    activities: {
        logo: function (parent) {
            this.x = 100;
            this.onActive = function (game, args) { }
            this.onInactive = function (game, args) { }
            this.onUpdate = function (dt) {
                this.x += 300 * dt;
                if (this.x > 300)
                    this.x = 100;
            }
            this.onDraw = function (g) {
                g.drawDebugCircle(this.x, 0, 0, 0);
            }
        },
    },
    startActivities: ['logo'],
});

$(document).ready(function () {
    /*
    var socket;
    try
    {
        socket = new WebSocket('ws://localhost:4492/');
    }
    catch (error)
    {
        alert(error);
    }
    
    socket.onopen = function () 
    {
        $('body').append('onopen');
        try
        {
            $('body').append('ready:' + socket.readyState);
            $('body').append('bufferedAmount:' + socket.bufferedAmount);
        }
        catch (error)
        {
            $('body').append('send error');
        }
    }
    
    socket.onclose = function () 
    {
        $('body').append('onclose');
    }
    
    socket.onmessage = function (response)
    {
        $('body').append('onmessage' + response.data);
    }
    */
});